home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gxfcid.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  5.3 KB  |  165 lines

  1. /* Copyright (C) 2000 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gxfcid.h,v 1.6 2000/09/19 19:00:36 lpd Exp $ */
  20. /* Definitions for CID-keyed fonts */
  21.  
  22. #ifndef gxfcid_INCLUDED
  23. #  define gxfcid_INCLUDED
  24.  
  25. #include "gxcid.h"        /* for CIDSystemInfo */
  26. #include "gxfont.h"
  27. #include "gxfont42.h"
  28.  
  29. /* ---------------- Structures ---------------- */
  30.  
  31. /*
  32.  * Define the data common to CIDFontType 0 (FontType 9, analogous to 1)
  33.  * and 2 (FontType 11, analogous to 42).
  34.  */
  35. #define MAX_GDBytes 4
  36. typedef struct gs_font_cid_data_s {
  37.     gs_cid_system_info_t CIDSystemInfo;
  38.     int CIDCount;
  39.     int GDBytes;        /* optional, for standard glyph_data */
  40.     /*int PaintType;*/
  41.     /*float StrokeWidth;*/
  42. } gs_font_cid_data;
  43.  
  44. extern_st(st_gs_font_cid_data);
  45. #define public_st_gs_font_cid_data()    /* in gsfcid.c */\
  46.   gs_public_st_suffix_add0_final(st_gs_font_cid_data,\
  47.     gs_font_cid_data, "gs_font_cid_data",\
  48.     font_cid_data_enum_ptrs, font_cid_data_reloc_ptrs,\
  49.     gs_font_finalize, st_cid_system_info)
  50. #define st_gs_font_cid_data_num_ptrs\
  51.   st_cid_system_info_num_ptrs
  52.  
  53. /*
  54.  * Define the structures for CIDFontType 0, 1, and 2 fonts.  In principle,
  55.  * each of these should be in its own header file, but they're so small
  56.  * that we include them here.
  57.  */
  58.  
  59. /* CIDFontType 0 references an array of (partial) FontType 1 fonts. */
  60.  
  61. #ifndef gs_font_type1_DEFINED
  62. #  define gs_font_type1_DEFINED
  63. typedef struct gs_font_type1_s gs_font_type1;
  64. #endif
  65.  
  66. #ifndef gs_font_cid0_DEFINED
  67. #  define gs_font_cid0_DEFINED
  68. typedef struct gs_font_cid0_s gs_font_cid0;
  69. #endif
  70.  
  71. #define MAX_FDBytes 4
  72. typedef struct gs_font_cid0_data_s {
  73.     gs_font_cid_data common;
  74.     ulong CIDMapOffset;        /* optional, for standard glyph_data */
  75.     gs_font_type1 **FDArray;
  76.     uint FDArray_size;
  77.     int FDBytes;        /* optional, for standard glyph_data */
  78.     /*
  79.      * The third argument of glyph_data may be NULL if only the font number
  80.      * is wanted.  glyph_data returns 1 if the string is newly allocated
  81.      * (using the font's allocator) and can be freed by the client.
  82.      */
  83.     int (*glyph_data)(P4(gs_font_base *, gs_glyph, gs_const_string *,
  84.              int *));
  85.     void *proc_data;
  86. } gs_font_cid0_data;
  87. struct gs_font_cid0_s {
  88.     gs_font_base_common;
  89.     gs_font_cid0_data cidata;
  90. };
  91.  
  92. extern_st(st_gs_font_cid0);
  93. #define public_st_gs_font_cid0() /* in gsfcid.c */\
  94.   gs_public_st_composite_use_final(st_gs_font_cid0,\
  95.     gs_font_cid0, "gs_font_cid0",\
  96.     font_cid0_enum_ptrs, font_cid0_reloc_ptrs, gs_font_finalize)
  97. #define st_gs_font_cid0_max_ptrs\
  98.   (st_gs_font_max_ptrs + st_gs_font_cid_data_num_ptrs + 2)
  99.  
  100. /* CIDFontType 1 doesn't reference any additional structures. */
  101.  
  102. typedef struct gs_font_cid1_data_s {
  103.     gs_cid_system_info_t CIDSystemInfo;
  104. } gs_font_cid1_data;
  105. typedef struct gs_font_cid1_s {
  106.     gs_font_base_common;
  107.     gs_font_cid1_data cidata;
  108. } gs_font_cid1;
  109.  
  110. extern_st(st_gs_font_cid1);
  111. #define public_st_gs_font_cid1() /* in gsfcid.c */\
  112.   gs_public_st_composite_use_final(st_gs_font_cid1,\
  113.     gs_font_cid1, "gs_font_cid1",\
  114.     font_cid1_enum_ptrs, font_cid1_reloc_ptrs, gs_font_finalize)
  115. #define st_gs_font_cid1_max_ptrs\
  116.   (st_gs_font_max_ptrs + st_cid_system_info_num_ptrs)
  117.  
  118. /* CIDFontType 2 is a subclass of FontType 42. */
  119.  
  120. #ifndef gs_font_cid2_DEFINED
  121. #  define gs_font_cid2_DEFINED
  122. typedef struct gs_font_cid2_s gs_font_cid2;
  123. #endif
  124. typedef struct gs_font_cid2_data_s {
  125.     gs_font_cid_data common;
  126.     int MetricsCount;
  127.     int (*CIDMap_proc)(P2(gs_font_cid2 *, gs_glyph));
  128.     /*
  129.      * "Wrapper" get_outline and glyph_info procedures are needed, to
  130.      * handle MetricsCount.  Save the original ones here.
  131.      */
  132.     struct o_ {
  133.     int (*get_outline)(P3(gs_font_type42 *, uint, gs_const_string *));
  134.     int (*get_metrics)(P4(gs_font_type42 *, uint, int, float [4]));
  135.     } orig_procs;
  136. } gs_font_cid2_data;
  137. struct gs_font_cid2_s {
  138.     gs_font_type42_common;
  139.     gs_font_cid2_data cidata;
  140. };
  141.  
  142. extern_st(st_gs_font_cid2);
  143. #define public_st_gs_font_cid2() /* in gsfcid.c */\
  144.   gs_public_st_composite_use_final(st_gs_font_cid2,\
  145.     gs_font_cid2, "gs_font_cid2",\
  146.     font_cid2_enum_ptrs, font_cid2_reloc_ptrs, gs_font_finalize)
  147. #define st_gs_font_cid2_max_ptrs\
  148.   (st_gs_font_type42_max_ptrs + st_gs_font_cid_data_num_ptrs)
  149.  
  150. /* ---------------- Procedures ---------------- */
  151.  
  152. /*
  153.  * Get the CIDSystemInfo of a font.  If the font is not a CIDFont,
  154.  * return NULL.
  155.  */
  156. const gs_cid_system_info_t *gs_font_cid_system_info(P1(const gs_font *));
  157.  
  158. /*
  159.  * Provide a default enumerate_glyph procedure for CIDFontType 0 fonts.
  160.  * Built for simplicity, not for speed.
  161.  */
  162. font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph);
  163.  
  164. #endif /* gxfcid_INCLUDED */
  165.